/* class Fish : public Observer
 *
 * Obsrever:
 *	implements the observer design pattern
 *
 * Bridge:
 *	implementation for creating fish objects
 *	the actual implementation is through classes that extend the ABC FishImpl
 *	and all of the methods are delegated through a FishImpl object
 *
 * Bridge design spec:
 *	bridge class: Fish
 *	actual implementation: FishImpl
 *	factory: FishFactory - creates FishImpl for Fish
 */

#pragma once
#include <string>
#include "Observer.h"
#include "Subject.h"
#include "Point.h"
#include "FishFactory.h"
#include <new>


class Fish : public Observer {
	//friend class FishFactory;

public:
	
	Fish();
	Fish(const Fish & fish);
	const Fish& operator=(const Fish & fish);
	~Fish();
	//=======================================================

	// Observer methods
	virtual void Update(Subject* ChngSubject, const std::string& message);
	virtual void setSubject(Subject *sbj);
	virtual Subject * getSubject(Subject *sbj);
	//=======================================================

	// class methods

	// these are the actual functions to create/destroy objects
	// throws bad_alloc& execption on mem. allocation faults
	void create(const FishFactory::FISH_TYPE& impl, Point& speed, const Point& location, bool transparent, int size);

	void copy(const Fish& fish);

	// a predicate to tell if the object was initialized (by using create() or some other way)
	bool initialized() const;

	// fish public methods
	int getID() const;

	virtual void feed();

	void pause();

	const Point& getSpeed() const;

	// set new speed - specify speed in each coord. and direction using +/-
	void setSpeed(const Point& speed);

	const Point& getLocation() const;

	void setLocation(const Point& location);

	bool isTransparent() const;

	void setTransparent(bool trans);

	int getSize() const;

	void setSize(int size);

	std::string getStats();

protected:
	static int counter;
	int id;
	FishImpl *fishImpl;
};
